{% extends "base.htm" %} 

{% block main_content %}

<div class="features_box">
	When the application runs in local environment, configure the development server to use an SMTP server or Sendmail; otherwise, the development server will log the contents of the message, and not send the message
</div>

<div class="title2">Send email</div>

{% if sending_notification %}
	<div class="notification_box">Email was sent</div>
{% endif %}
<p>
{% if userLogin %}
	Hi <i>{{ userEmail }}</i> (<a class="command_link" href="{{ authenUrl }}">logout</a>)
{% else %}
<div class="features_box">
	The Send button is disabled. Please login with Google account to send email. <a class="command_link" href="{{ authenUrl }}">Login</a> 
</div>
{% endif %}
</p>
<form action="/mail" method="post">
<input type="hidden" name="action" value="sendemail" />
<table class="data_table"><tr><td>Receiver emails</td><td><input type="text" class="normal_text_field" name="receivers" /> <i>Use ',' for separator </i></td></tr>
<tr><td>Subject</td><td><input type="text" class="normal_text_field" name="subject" /></td></tr>
<tr><td>Attachment</td><td><input type="file" name="attach_file" /></td></tr>
<tr><td>Body (plain text)</td><td><textarea class="normal_textarea_field" name="message"></textarea></td></tr>
<tr><td colspan="2" align="right"><input type="submit" value="Send" {% if not userLogin %} disabled="disabled" {% endif %} /></td></tr>
</table>
</form>

<br />
<div class="title2">Receive email</div>

{% if appId %}
	The current application identifier is: <b>{{ appId }}</b>. To update it, go to <a href="/home">Home page</a>
{% else %}
	<div class="features_box">The demo of Receiving Email needs to know application identifier to function. Please update it at <a href="/home">Home page</a></div>
{% endif %}

<p>
Send an email to <b>forwarder@APP-ID.appspotmail.com</b> with <b>APP-ID</b> is the application identifier. Then that email will be forwarded to the email saved in below textbox.
For example: if your APP-ID is barcamp2011, send to <b>forwarder@barcamp2011.appspotmail.com</b>
</p>


<p>
<form action="/mail" method="post">
<input type="hidden" name="action" value="setforwardemail" />
Email to forward <input type="text" class="normal_text_field" name="email" value="{{ forwardEmail }}" /><input type="submit" value="Save" />
</form>
</p>


{% endblock %}
